/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.chlitina.store.common.service.BaseService;
import com.chlitina.store.modules.expert.dao.SolutionFaceCareLocationSeasonDao;
import com.chlitina.store.modules.expert.entity.SolutionFaceCare;
import com.chlitina.store.modules.expert.entity.SolutionFaceCareLocationSeason;

/**
 * 方案护理区域季节Service
 * @author liujiang
 * @version 2014-02-17
 */
@Component
@Transactional(readOnly = true)
public class SolutionFaceCareLocationSeasonService extends BaseService {

	@SuppressWarnings("unused")
	private static Logger logger = LoggerFactory.getLogger(SolutionFaceCareLocationSeasonService.class);
	
	@Autowired
	private SolutionFaceCareLocationSeasonDao solutionFaceCareLocationSeasonDao;
	
	public List<SolutionFaceCareLocationSeason> getBy(SolutionFaceCare solutionFaceCare) {
		DetachedCriteria dc = solutionFaceCareLocationSeasonDao.createDetachedCriteria();
		dc.add(Restrictions.eq("solutionFace", solutionFaceCare.getSolutionFace()));
		dc.add(Restrictions.eq("care", solutionFaceCare.getCare()));
		dc.addOrder(Order.asc("systemDefinitionAreaSeason.id"));
		return solutionFaceCareLocationSeasonDao.find(dc);
	}
	
	@Transactional(readOnly = false)
	public void save(SolutionFaceCareLocationSeason solutionFaceCareLocationSeason) {
		solutionFaceCareLocationSeasonDao.save(solutionFaceCareLocationSeason);
	}
	
	@Transactional(readOnly = false)
	public void delete(Long mid, Long cid, Long tid) {
		solutionFaceCareLocationSeasonDao.delete(mid, cid, tid);
	}
	
}
